#include "uiBase_Test.h"

#include "server/ui/uiBase.h"
#include "misc/Interface.h"
#include <iostream>
#include <string>
/*********************************************************/
std::string uiBaseTest::name()
{
	return("uiBase");
}
/*********************************************************/
bool uiBaseTest::runUnitTests()
{
	bool result = true;

	if ( !parseHelpTest() ) result = false;

	return( result ) ;
}
/*********************************************************/
bool uiBaseTest::parseHelpTest()
{
	Interface& intf = Interface::Instance();
	intf.start("INPUT");
	uiBase* base = uiBase::parse("?");
	if ( base ) {
		intf.stop();
		std::cout << "Running: parseHelpTest()";
		std::cout << "... failed!" << std::endl;
		return( false );
	}

	base = 0;
	base = uiBase::parse("? JUNK");		// Test the ? with some junk added!
	if ( base ) {
		intf.stop();
		std::cout << "Running: parseHelpTest()";
		std::cout << "... failed!" << std::endl;
		return( false );
	}

	intf.stop();
	std::cout << "Running: parseHelpTest()";
	std::cout << "... success!" << std::endl;
	return (true);
}
